package main

import (
	"embed"
	"github.com/wailsapp/wails/v2"
	"github.com/wailsapp/wails/v2/pkg/menu"
	"github.com/wailsapp/wails/v2/pkg/options"
)

//go:embed all:frontend/dist
var assets embed.FS

func main() {

	// Create an instance of the app structure

	app := NewApp()

	AppMenu := menu.NewMenu()

	err := wails.Run(&options.App{
		Title:            "财务小帮手",
		Width:            1024,
		Height:           768,
		Assets:           assets,
		BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
		Menu:             AppMenu,
		OnStartup:        app.startup,
		OnShutdown:       app.shutdown,
		Bind: []interface{}{
			app,
		},
	})

	if err != nil {
		println("Error:", err.Error())
	}
}

type TreeData struct {
	Title    string     `json:"title"`
	Key      string     `json:"key"`
	IsLeaf   bool       `json:"isLeaf"`
	Children []TreeData `json:"children"`
}
